Omplus.base.define(Omplus.controllers.Controller, {
    omplusName:"dashboardController"
});

//Omplus.base.define(Omplus.models.Model, {
//    omplusName:"GoogleModel",
//    value:{
//        title:{
//            opmplusType:"String"
//        },
//        columns:{
//            omplusType:"Array",
//            omplusProto:"columnProto"
//
//        },
//        rows:{
//            omplusType:"Array",
//            omplusProto:"RowProto"
//        },
//        controller:"x"
//
//
//    }
//});
//
//Omplus.models.ColumnProto = Omplus.base.extend(Omplus.model.Object, {
//    omplusType:"ColumnProto",
//    value:{
//        "columnType":{
//            omplusType:"String"
//        },
//        "columnLabel":{
//            omplusType:"Label"
//        },
//        "columnId":{
//            omplusType:"Number"
//        }
//    }
//});
//
//Omplus.base.define(Omplus.models.ColumnProto, {
//
//});

Omplus.base.define(Omplus.views.Panel, {
    omplusName:"dashboardPanel",
    controller:"dashboardController",
    renderTo:"managements",
    models:{
    },
    components:[
        {
            omplusType:"TabPanel",
            omplusName:"dashboardFirstPanel",
            layout:{
                omplusType:"HorizontalLayout"
            },
            components:[
//                {
//                    omplusType:"GoogleChart",
//                    omplusName:"GoogleChart1",
//                    model:"GoogleModel",
//                    controller:"x"
//                }
            ],
            model:"Assets.list.dashboard_label.localValue",
            controller:"languageController"
        }
    ],
    layout:{
        omplusType:"TabLayout"
    },
    showEffect:{
        name:"explode",
        time:300
    },
    hideEffect:{
        name:"explode",
        time:300
    }
});


Omplus.views.GoogleChart = Omplus.base.extend(Omplus.views.Panel, {
    render:function () {
        this.chart = jQuery.extend(true, {}, $("<div></div>"));
        this.chart.attr("id", this.omplusName).appendTo(this.content);
    },
    setValue:function (newValue) {
        console.log(newValue);
        // Create the data table.
        var data = new google.visualization.DataTable();
        var title = Omplus.globals.getObject(this.model + ".title").getValue();
        data.addColumn('string', title, '1');
        data.addColumn('number', 'Slices', '2');
        data.addRows([
            ['Mushrooms', 3],
            ['Onions', 1],
            ['Olives', 1],
            ['Zucchini', 1],
            ['Pepperoni', 2]
        ]);

        // Set chart options
        var options = {'title':'How Much Pizza I Ate Last Night',
            'width':400,
            'height':300};

        this.data = data;
        this.options = options;

        this.draw();
    },
    draw:function () {
        // Instantiate and draw our chart, passing in some options.
        var chart = new google.visualization.PieChart(
            document.getElementById(this.omplusName)
        );
        chart.draw(this.data, this.options);
    },
    omplusType:"GoogleChart",
    title:"Title",
    data:null,
    options:null
});